function filter(arr, standard) {
    var result = [];
    for (var i = 0; i < arr.length; i++) {
        var item = arr[i]; // { name: 'zs', score: 59 }
        // 59: item.score
        // 'ls': item.name
        if (item.score > standard) {
            result.push(item.name);
        }
    }
    return result;
}

var students = [
    { name: 'zs', score: 59 },
    { name: 'ls', score: 69 },
    { name: 'ww', score: 79 },
    { name: 'll', score: 89 },
];

// 新写法
function filter(arr, standard) {
  return arr
    .filter(item => item.score > standard) // { name: 'zs', score: 59 }
    .map(item => item.name); // { name: 'zs', score: 59 } >> 'zs'
}

// 筛选大于60分的同学
console.log(filter(students, 60)); // ['ls', 'ww', 'll']
// 筛选大于80分的同学
console.log(filter(students, 80)); // ['ll']
